package com.yuexun.beilunpatient.ui.docAdvice.adapter;

import android.text.TextUtils;
import android.widget.AbsListView;

import com.yuexun.beilunpatient.R;
import com.yuexun.beilunpatient.ui.docAdvice.bean.DocAdvice_OrderDetail;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;

/**
 * Created by chenss on 2018/3/29 0029.
 */

public class DispensingListListAdapter extends KJAdapter<DocAdvice_OrderDetail> {

    public DispensingListListAdapter(AbsListView view, Collection<DocAdvice_OrderDetail> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder helper, DocAdvice_OrderDetail item, boolean isScrolling) {
        super.convert(helper, item, isScrolling);

        if (!TextUtils.isEmpty(item.getMedname1())) {
            helper.setText(R.id.tv_name, item.getMedname() + " * " + item.getNum() + " * " + item.getMedname1());
        } else {
            helper.setText(R.id.tv_name, item.getMedname() + " * " + item.getNum());
        }

        if (!TextUtils.isEmpty(item.getDoseusnit())) {
            helper.setText(R.id.tv_dosage, item.getDosage() + item.getDoseusnit());
        }
    }
}
